﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Webdiyer.WebControls.Mvc;

namespace Web.Controllers
{
    public class NewsController : Controller
    {
        private Manager.BLL.Admin.M_NewsBll bllNews = new Manager.BLL.Admin.M_NewsBll();
        //
        // GET: /News/
        /// <summary>
        /// 行业新闻列表首页
        /// </summary>
        /// <param name="id">页码</param>
        /// <returns></returns>
        public ActionResult Index(int? page)
        {
            PagedList<Manager.Model.Admin.M_News> news = new PagedList<Manager.Model.Admin.M_News>(bllNews.GetModelList("IsValid=1"), page ?? 1, 10);
            return View(news);
        }

        /// <summary>
        /// 新闻明细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Details(int? id)
        {
            int newsid = id ?? 0;
            if (bllNews.Exists(newsid))
            {
                return View(bllNews.GetModel(newsid));
            }
            else
                return View();
        }
    }
}
